<?php

namespace App\library\services;

use App\Models\QuickEntrance;

class QuickEntranceService extends BaseServices
{
    /**
     * Author:Zhongyuan Lu
     * 获取快捷入口列表
     * @param $page_type
     * @param $ascription
     * @return array
     */
    public static function getList($page_type,$ascription)
    {
        $where = [
            ['page_type', '=', $page_type],     //页面类型
            ['ascription', '=', $ascription],   //归属
            ['status', '=', 1]                  //状态
        ];
        $field = ['title','desc','href','image'];
        $data = QuickEntrance::where($where)->orderBy('sort','asc')->get($field)->toArray();

        if (empty($data)) {
            return self::fail('无数据');
        }
        foreach ($data as &$v) {
            $v['image'] = "" . $v['image'];
        }
        unset($v);
        return self::success('success',$data);
    }
}
